<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

        <title>人事管理</title>
		<script src="/js/jquery.js"></script>
        <link href="../../css/mine.css" type="text/css" rel="stylesheet" />
    </head>
	<script>
		//全选/反选
		function selectedAll() {
			var allsel = document.getElementsByName("uid");/* uid为复选框的name属性值 */
			for ( var i = 0; i < allsel.length; i++) {
				allsel[i].checked = !allsel[i].checked;
			}
		}
	</script>
    <body>
        <style>
            .tr_color{background-color: #9F88FF}
        </style>
        <div class="div_head">
            <span>
                <span style="float: left;">当前位置是：人事管理-》人事档案管理</span>
                <span style="float: right; margin-right: 8px; font-weight: bold;">
                    <a style="text-decoration: none;" href="/personnel/add-ui">【档案登记】</a>
                </span>
            </span>
        </div>
        <div></div>
        <div class="div_search">
            <span>
                <form action="/personnel/manage" method="post">
                   姓名: 
					<input type="text"  name="username" value="${username}"/>
					 审核状态: 
					<select name="checkStatus">
						<option value="">--请选择--</option>
						<option <c:if test="${'起草' eq checkStatus}">selected</c:if>>起草</option>
						<option <c:if test="${'审核中' eq checkStatus}">selected</c:if>>审核中</option>
						<option <c:if test="${'审核通过' eq checkStatus}">selected</c:if>>审核通过</option>
						<option <c:if test="${'驳回' eq checkStatus}">selected</c:if>>驳回</option>
						<option <c:if test="${'变更' eq checkStatus}">selected</c:if>>变更</option>
						<option <c:if test="${'变更审核中' eq checkStatus}">selected</c:if>>变更审核中</option>
					</select>
					档案状态：
					<select name="status">
						<option value="">--请选择--</option>
						<option <c:if test="${'试用期' eq status}">selected</c:if>>试用期</option>
						<option <c:if test="${'正式员工' eq status}">selected</c:if>>正式员工</option>
						<option <c:if test="${'离职' eq status}">selected</c:if>>离职</option>
						<option <c:if test="${'已删除' eq status}">selected</c:if>>已删除</option>
						<option <c:if test="${'实习员工' eq status}">selected</c:if>>实习员工</option>
					</select>
					建档时间：
					<input type="text" name="beginTime"
						   value="<fmt:formatDate value="${beginTime}" pattern="yyyy-MM-dd"/>">至
					<input type="text" name="endTime"
						   value="<fmt:formatDate value="${endTime}" pattern="yyyy-MM-dd"/>"/>
                    <input value="查询" type="submit" />
					
                </form>
            </span>
        </div>
        <div style="font-size: 13px; margin: 10px 5px;">
            <table class="table_a" border="1" width="100%">
                <tbody><tr style="font-weight: bold;">
                        <td width="30px;">
							全选<br/><input type="checkbox" onchange="selectedAll()"/></td>
                        <td width="80px;">档案编码</td>
                        <td >姓名</td>
						<td>性别</td>
						<td>所属部门</td>
						<td>职位</td>
						<td>职称</td>
						<td>建档日期</td>
						<td>审核状态</td>
						<td>档案状态</td>                      
                        <td align="center" width="100px;">操作</td>
                    </tr>


				<c:forEach items="${pageInfo.list}" var="person" varStatus="i">
					<tr id="product1">
						<td><input type="checkbox" name="uid"/></td>
						<td>${person.danganid}</td>
						<td>${person.username}</td>
						<td>${person.sex}</td>
						<td>${person.deptName}</td>
						<td>${person.permname}</td>
						<td>${person.jobName}</td>
						<td><fmt:formatDate value="${person.creattime}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
						<td>${person.checkstatus}</td>
						<td>${person.status}</td>
						<td>
							<c:if test="${person.checkstatus eq '起草' or  person.checkstatus eq '审核驳回'}">
								<a href="/personnel/update-ui?id=${person.id}">修改</a>
							</c:if>
							<c:if test="${person.checkstatus eq '起草' or  person.checkstatus eq '审核驳回'}">
								<%--<a href="/personnel/delete?id=${person.id}">删除</a>--%>
								<a href="javascript:void(0);" onclick="deleteOne(${person.id})">删除</a>
							</c:if>
							<c:if test="${person.checkstatus eq '审核通过'or  person.checkstatus eq '变更'
							or  person.checkstatus eq '变更审核中'}">
								<a href="/personnel/modify-ui?id=${person.id}">变更</a>
							</c:if>
							<a href="/personnel/info?id=${person.id}">明细</a>

						</td>
					</tr>
				</c:forEach>


                    <tr>
                        <td colspan="20" style="text-align: center;">
							<a style="text-decoration: none;" href=
									"/personnel/manage?index=1
                                    &username=${username}&checkStatus=${checkStatus}&status=${status}&beginTime=${beginTime}&endTime=${endTime}">首页</a>
							<a style="text-decoration: none;" href=
									"/personnel/manage?index=${pageInfo.prePage==0?1:pageInfo.prePage}
                                    &username=${username}&checkStatus=${checkStatus}&status=${status}&beginTime=${beginTime}&endTime=${endTime}">上一页</a>

							<c:forEach var="i" begin="1" end="${pageInfo.pages}">
								<a style="text-decoration: none;" href="/personnel/manage?
                                index=${i}&username=${username}&checkStatus=${checkStatus}&status=${status}&beginTime=${beginTime}&endTime=${endTime}">${i}</a>
							</c:forEach>

							<a style="text-decoration: none;" href=
									"/personnel/manage?index=${pageInfo.nextPage==0?pageInfo.pages:pageInfo.nextPage}
                                    &username=${username}&checkStatus=${checkStatus}&status=${status}&beginTime=${beginTime}&endTime=${endTime}">下一页</a>

							<a style="text-decoration: none;" href=
									"/personnel/manage?index=${pageInfo.pages}
                                    &username=${username}&checkStatus=${checkStatus}&status=${status}&beginTime=${beginTime}&endTime=${endTime}">尾页</a>

							共${pageInfo.total}条 当前页 ${pageInfo.pageNum}/${pageInfo.pages} </a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
		<script type="text/javascript">
			function deleteOne(id) {
				if (confirm("您确认删除该人事信息吗?")){
					$.get(
							"/personnel/delete?id="+id,
							null,
							function (rs) {
								if (rs.code==0){
									alert('删除成功');
									location.href='/personnel/manage'
								} else {
									alert('删除失败');
									location.href='/personnel/manage'
								}
							},
							"json"
					);
				}
			}
		</script>
    </body>
</html>